package dome1;
public class Pet {
    private String name;
    private String type;
    private int age;
    private String color;
    private int hungerDegree;
    private boolean isDead;

    public Pet(String name, String type, int age, String color, int hungerDegree) {
        this.name = name;
        this.type = type;
        this.age = age;
        this.color = color;
        this.hungerDegree = hungerDegree;
        this.isDead= false;
    }


    public Pet(){}

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public boolean isDead() {
        return isDead;
    }

    public void setDead(boolean dead) {
        isDead = dead;
    }

    public int getHungerDegree() {
        return hungerDegree;
    }

    public void setHungerDegree(int hungerDegree) {
        this.hungerDegree = hungerDegree;
        if (hungerDegree >= 100)
            this.isDead = true;

    }



    @Override
    public String toString() {
        return "{" +
                "名字='" + name + '\'' +
                ", 类型='" + type + '\'' +
                ", 年龄=" + age +
                ", 颜色='" + color + '\'' +
                ", 饥饿度=" + hungerDegree +

                '}';
    }
    public void print(){
        System.out.println(this.toString());
    }
    public void eat(){
        System.out.println("宠物正在吃东西");
    }

}
